Display Settings PropertiesConditional style

Description

The conditional formatting option in Alpha Anywhere lets you format data conditionally, depending on its value. For example, you might set the color of the quantity field to be red if it is above average.

Discussion

In the video, you'll see the conditional formatting in action, including conditional formatting at the cell and control level, and conditional formatting at the row level.

To see how to add conditional images to a grid, check out this video.

Where this property allows you to alter the styles of a field, you can also alter the style of a given row using the Conditional Style properties in the Shading and Dividers section of the Grid Properties page.

Create a Conditional Style for a Field:

  1. Open the Grid Builder and go to the Design tab. On the Component Type page select read-only

  2. On the Data Source page select either .dbf or SQL . This example uses the SQL table Northwind database.

  3. On Query(DBF) or Query(AlphaDAO) create the connection to your database and select a table to work with. This example uses the Order_details table.

  4. On the Fields page add some fields from the Available Fields: list to the Selected: fields list.

    images/01_constyle.png
  5. Select a selected field, in this case Quantity, and scroll down the field's property list to the Summary values section.

    images/01_constyle2.png
  6. Check the Average checkbox under the Summary values section.

    images/01_constyle3.png
  7. Still in Field Properties , go to the Display Settings and click the Conditional style property button.

    images/01_constyle4.png
  8. The Conditional Style (Server-side) dialog will open. Click the Add condition button at the bottom of the dialog.

    images/01_constyle5.png
  9. The Edit Condition dialog will load. Click the ' Insert Fieldname ' hyperlink.

    images/01_constyle6.png
  10. Add the 'Quantity' field, or the fields you are using, to your expression. Then after it add '> summary.quantity.average' to complete the Expression.

    Quantity > summary.quantity.average
    images/01_constyle7.png
  11. In the Style: menu click on the Font color selector button and change the font color. Click OK to add the Expression to the Conditional Style dialog.

    images/01_constyle8.png
  12. Click the Add condition button again. Add a second condition, this time using a less than < sign.

    Quantity < summary.quantity.average
  13. Set a different Font color for this condition. Click OK, the Conditional Style (Server-side) dialog should now look something like this:

    images/01_constyle9.png
  14. Now go to Live Preview > Full Preview . All of the records in the Quantity field should be colored differently, depending on if they are above or below the average.

    images/01_constyle10.png
    In the Quantity field blue is below and green above average

Videos

Conditional Formatting

The conditional formatting option allows you to format data conditionally, depending on the value in the field. For example, you might set the color of the quantity field to be red if it is above average. In this video, we demonstrate conditional formatting at the cell and control level and conditional formatting at the row level.

Conditional Images

The conditional image feature allows you to display different icons in the Grid component based on the data in each row. This video demonstrates how above average quantities have a green icon and below average have a red icon. There is no limit to the number of conditional tests.

See Also